package com.server.questionbank.snframe.util.FileUtil.policy.factory;

import com.server.questionbank.snframe.util.FileUtil.policy.BucketPolicy;
import com.server.questionbank.snframe.util.FileUtil.policy.PolicyType;
import com.server.questionbank.snframe.util.FileUtil.policy.impl.ReadOnlyPolicy;
import com.server.questionbank.snframe.util.FileUtil.policy.impl.ReadWritePolicy;
import com.server.questionbank.snframe.util.FileUtil.policy.impl.WriteOnlyPolicy;

/**
 * 策略工厂类
 */
public class PolicyFactory {
    
    public static BucketPolicy createPolicy(PolicyType type) {
        return switch (type) {
            case READ_ONLY -> new ReadOnlyPolicy();
            case WRITE_ONLY -> new WriteOnlyPolicy();
            case READ_WRITE -> new ReadWritePolicy();
            default -> throw new IllegalArgumentException("Unsupported policy type: " + type);
        };
    }
} 